package com.core;

import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @Description TODO
 * @Author 泥地里的蝴蝶
 * @Date 2024/5/10 20:55
 */
public class ProceedingJoinPoint extends JoinPoint{
    private Object targetObject;
    private MethodProxy methodProxy;

    public ProceedingJoinPoint(Object targetObject, MethodProxy methodProxy,Method method, Object[] args ) {
        super(method,args);
        this.targetObject = targetObject;
        this.methodProxy = methodProxy;
    }

    @Override
    public Object invoke(Object[] args) throws Throwable {
        return methodProxy.invokeSuper(targetObject,args);
    }

    @Override
    public Object invoke() throws Throwable {
        return methodProxy.invokeSuper(targetObject,getArgs());
    }
}
